package cn.school.controller.notice;

import cn.school.common.api.CommonPage;
import cn.school.common.api.CommonResult;
import cn.school.notice.entity.FamilyNotice;
import cn.school.notice.service.FamilyNoticeService;
import cn.school.notice.vo.FamilyNoticeVO;
import cn.school.student.entity.vo.StudentInfoVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@Api(tags = "t_school_notice => 校园通知管理表")
@RequestMapping("/familyNotice")
public class FamilyNoticeController {

    @Resource
    private FamilyNoticeService familyNoticeService;

    @ApiOperation("familyNoticePageList => 分页查询校园通知管理表")
    @PostMapping(value = "/familyNoticePageList")
    public CommonResult<CommonPage<FamilyNotice>> familyNoticePageList(@RequestBody FamilyNoticeVO notice) {
        IPage<FamilyNotice> noticePageList = familyNoticeService.familyNoticePageList(notice);
        return CommonResult.success(CommonPage.restPage(noticePageList));
    }
    
    @ApiOperation("getAcsRecordByStudentInfo => 获取学生进出校园记录")
    @PostMapping(value = "/getAcsRecordByStudent")
    public CommonResult<List<FamilyNotice>> getAcsRecordByStudent(@RequestBody StudentInfoVo vo) {
        List<FamilyNotice> familyNotices = familyNoticeService.getAcsRecordByStudent(vo);
        return CommonResult.success(familyNotices);
    }
}
